package com.rest.ribbon.springcloudribbon;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;


/**
 * @author Wangcc
 * @version V1.0
 * @Description: 断路器  @EnableCircuitBreaker注解开启Hystrix：
 * @date 2018/3/9 13:25
 */
@EnableCircuitBreaker
@SpringBootApplication
@EnableDiscoveryClient
public class SpringCloudRibbonApplication {

	private static final Logger log = LoggerFactory.getLogger(SpringCloudRibbonApplication.class);

	public static void main(String[] args) {
		SpringApplication.run(SpringCloudRibbonApplication.class, args);
		log.error("********** SPRING CLOUD START UP SUCCESS **********");
	}

	@Bean
	@LoadBalanced
	RestTemplate restTemplate() {
		return new RestTemplate();
	}
}
